﻿using UnityEngine;
using System.Collections;



public class MoveParam {

    private int _numNode;
    private int _curNode;
    private Position[] _target;

    private const int MAX_CHAR_PATH_NODE_NUMBER = 10;

    public MoveParam()
    {
        _target = new Position[MAX_CHAR_PATH_NODE_NUMBER];
        _numNode = _curNode = 0;
    }

    public void Reset()
    {
        _numNode = _curNode = 0;
    }

    public bool IsEmpty()
    {
        return (((_numNode == 0) || (_numNode == _curNode)) ? (true) : (false));
    }

    public void AddTargetPos(Position pos)
    {
        if (_numNode < MAX_CHAR_PATH_NODE_NUMBER)
        {
            _target[_numNode++] = pos;
        }
    }

    public Position GetCurTargetPos()
    {
        return _target[_curNode];
    }

    public Position GetFinalTargetPos()
    {
        return _target[_numNode-1];
    }

    public int Count()
    {
        return _numNode - _curNode;
    }

    public bool NextTargetPos()
    {
        if (_curNode < _numNode)
            _curNode++;

        if (_curNode < _numNode)
            return true;
        else 
            return false;
    }
    public void Reverse()
    {
        for (int i = 0; i < (_numNode>>1);++i)
        {
            Position pos = _target[i];
            _target[i] = _target[_numNode - i];
            _target[_numNode - i] = pos;
        }
    }
}
